package com.itheima.demo4;

import java.io.*;
import java.net.Socket;

public class Client {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1", 8888);

        BufferedInputStream bufferedInputStream = new BufferedInputStream(new FileInputStream("D:\\itheima\\mn.jpg"));
        BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(socket.getOutputStream());
        BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        byte[] bytes =new byte[8192];
        int len;
        while((len = bufferedInputStream.read(bytes)) != -1){
            bufferedOutputStream.write(bytes,0,len);
        }
        bufferedOutputStream.flush();

        socket.shutdownOutput();


        System.out.println(br.readLine());

        bufferedInputStream.close();
        socket.close();
    }
}
